﻿using Bids.Core.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Telerik.OpenAccess;
using Telerik.OpenAccess.Metadata;
using Telerik.OpenAccess.Metadata.Fluent;
namespace Bids.Core.DomainObjects
{
	/// <summary>
	/// 投稿项
	/// </summary>
	[Serializable]
    public partial class ContributionItem : IEntity
	{

		
		/// <summary>
		/// 
		/// </summary>
        public virtual int ID { set; get; }
		/// <summary>
		/// 投稿
		/// </summary>
        public virtual int ContributionId { set; get; }
		/// <summary>
		/// 展示LOGO
		/// </summary>
        public virtual string Logo { set; get; }
		/// <summary>
		/// 提交时间
		/// </summary>
        public virtual DateTime CreateTime { set; get; }
		/// <summary>
		/// 说明
		/// </summary>
        public virtual string Explain { set; get; }
        
        /// <summary>
        /// 投稿
        /// </summary>
        public virtual Contribution Contribution { get; set; }
        public static MappingConfiguration<ContributionItem> CreateConfiguration()
        {
            var threadMapping = new MappingConfiguration<ContributionItem>();
            threadMapping.MapType(t => new
            {
                t.ID,
                t.ContributionId,
                t.Logo,
                t.CreateTime,
                t.Explain
            }).ToTable("ContributionItems");
            threadMapping.HasProperty(t => t.ID).IsIdentity(KeyGenerator.Autoinc);
            threadMapping.HasAssociation(t => t.Contribution).WithOpposite(d => d.ContributionItems).HasConstraint((t,d)=>t.ContributionId == d.ID);
            
            return threadMapping;
        }
	}
}

